home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / hot_36.zip / HOT36.ASM < prev    next >
Assembly Source File  |  1988-12-27  |  3KB  |  161 lines

  1. ;HOT.ASM
  2. ;From SIMTEL20's PD:<MSDOS.SYSUTL>
  3. ;Original Toad Hall Tweak, 5 Sep 88
  4. ; v3.6, 27 Dec 88
  5. ; -    Tightening code a little.
  6. ; -    Moved Page 0 save buffer to "dynamic" code space at program end.
  7. ; -    Getting Int 9 vector from our save buffer rather than the Svc 35h.
  8.  
  9. Page0    SEGMENT AT 0
  10.     org    417H
  11. kbdflag    db    ?        ;keyboard state flag
  12.  
  13. Page0    ENDS
  14.  
  15. CSeg    SEGMENT WORD PUBLIC 'PROG'
  16.     ASSUME    CS:CSeg, DS:CSeg
  17.  
  18.     org    100H
  19.  
  20. Hot    proc    near    ;TH
  21.     jmp    Go_Strt
  22.  
  23. ;icopy    db    400h dup (?)
  24. ;oldkey    dw    0,0
  25. blksiz    dw    0
  26. blkadr    dw    0
  27. Hot    endp    ;TH
  28.  
  29. ;;;;;
  30. Go_Key    proc    far    ;TH
  31.     ASSUME    DS:Nothing,ES:Nothing
  32.  
  33.     pop    DS
  34.     pop    ax
  35. ;    jmp    CS:dword ptr oldkey
  36.     jmp    CS:dword ptr int9        ;jump to old Int 9 vector v1.2
  37. Go_Key    endp        ;TH
  38.  
  39. My_Key    proc    far    ;TH
  40.     push    ax
  41.     push    DS
  42.  
  43.     xor    ax,ax        ;Page 0
  44.     mov    DS,ax
  45.     ASSUME    DS:Page0,ES:Nothing
  46.  
  47.     mov    al,kbdflag        ;DOS keyboard state flag
  48.     and    al,0ch
  49.     cmp    al,0ch
  50.     jne    Go_Key            ;not pressed, continue to old int
  51.  
  52.     in    al,60h            ;read the kbd
  53.     and    al,7fh            ;mask for possible values
  54.     cmp    al,82            ;INS key?
  55.     jne    Go_Key            ;nope, go on to old interrupt
  56.  
  57. ; yes, eat the key
  58.     in    al,61h            ;read kbd
  59.     mov    ah,al            ;save char in AH
  60.     or    al,80h            ;reset kbd interrupt
  61.     out    61h,al
  62.     xchg    ah,al            ;kbd byte
  63.     out    61h,al            ;back to kbd
  64.     mov    al,20h            ; non-specific EOI for 8259
  65.     out    20h,al
  66. ; do the HOT-BOOT
  67.     mov    ax,CS
  68.     mov    DS,ax
  69.     ASSUME    DS:CSeg
  70.  
  71. ;Setting up the block after our resident code as the "next free block"
  72. ;for DOS.
  73.     mov    ax,blkadr
  74.     mov    ES,ax
  75.     ASSUME    ES:Nothing
  76.  
  77.     xor    di,di            ;segment base    TH
  78.     cld                ;insure fwd
  79.     mov    al,5ah
  80.     stosb
  81.     xor    ax,ax    ;TH
  82.     stosw
  83.     mov    ax,blksiz
  84.     stosw
  85.  
  86.     xor    ax,ax
  87.     mov    ES,ax            ;ES=page 0
  88.     mov    ax,CS
  89.     mov    DS,ax
  90.     ASSUME    DS:CSeg,ES:Page0
  91.  
  92.     mov    si,offset icopy        ;the base data we copied on install
  93.     xor    di,di            ;to Page 0 base            v1.1
  94.     mov    cx,200h            ;200H words
  95.     rep    movsw            ;ints are off during this 'rep' move
  96.  
  97.     mov    bx,CS
  98.     mov    ah,50h            ; set psp
  99.     int    21h
  100.     mov    ax,4c00h        ;terminate process
  101.     int    21h        
  102. My_Key    endp
  103.  
  104.     
  105. Go_Strt    proc    near
  106.     mov    bx,DS            ;save DS a sec            v1.2
  107.     xor    ax,ax
  108.     mov    DS,ax
  109.     ASSUME    DS:Page0,ES:CSeg
  110.  
  111.     cld                ;insure fwd
  112.     xor    si,si            ;from Page 0 base
  113.     mov    di,offset icopy        ;into our buffer
  114.     mov    cx,200h            ;copy 200H words
  115.     rep    movsw
  116.  
  117.     mov    DS,bx            ;restore DS            v1.2
  118.     ASSUME    DS:CSeg
  119.  
  120. ;;    mov    ax,3509h        ; get int 9
  121. ;;    int    21h
  122. ;    les    ax,dword ptr int9    ;get Int 9 vector from our buffer v1.2
  123. ;    mov    oldkey,ax        ;save old Int 9 vector
  124. ;    mov    oldkey+2,ES
  125.     mov    ax,2509h        ;Set Int 9 vector
  126.     mov    dx,offset My_Key    ;to our service
  127.     int    21h
  128.  
  129.     mov    ax,CS
  130.     mov    ES,ax
  131.     ASSUME    DS:CSeg
  132.  
  133.     mov    bx,offset endpgm    ;code end
  134.     add    bx,15            ;a little space
  135.     mov    cl,4            ;*4 for paras
  136.     shr    bx,cl
  137.     mov    dx,bx            ;into DX
  138.     mov    ax,CS
  139.     add    ax,dx
  140.     mov    blkadr,ax        ;next segment block
  141.     mov    ah,4ah            ;modify allocated blocks
  142.     int    21h
  143.     mov    bx,0ffffh        ;how much is there?
  144.     mov    ah,48h            ;allocate memory function
  145.     int    21h
  146.     mov    blksiz,bx        ;returned in BX, save
  147.     mov    ax,3100h        ;go TSR
  148.     int    21h
  149. Go_Strt    endp    ;TH
  150.  
  151.     even
  152.  
  153. PC    =    $
  154. icopy    =    PC            ;buffer to save Page 0
  155. int9    =    PC + (9 * 4)        ;start of saved Int 9 vector
  156. PC    =    PC + 400H        ;400 bytes long
  157. endpgm    =    PC
  158.  
  159. CSeg    ends
  160.     end    Hot
  161.